import Vue from "vue";
import VueRouter from "vue-router";
// import r from "./generateRoutes"

//解决路由导航到统一路径重复报错的问题
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


Vue.use(VueRouter);

const routes = [
  // ...r
  // {
  //   path:"/",
  //   redirect: "/welcome",
  //   component:()=>import(/*webpackChunkName:'home'*/'@/pages/Home'),
  //   children:[
  //     {
  //       path:"welcome",
  //       component:()=>import(/*webpackChunkName:'welcome'*/'@/pages/Home/Welcome')
  //     }
  //   ]
  // },
  {
    path:"/Login",
    component:()=>import(/*webpackChunkName:'login'*/'@/pages/Login')
  },
  {
    path:"*", //其他页面匹配不到就 匹配404
    component:()=>import("@/pages/Page404")
  }
];

const router = new VueRouter({
  routes,
});

export default router;
